All Questions
39 questions
0votes
0answers
33views
Can't use combination of parentheses and variables in scripts [duplicate]
I have problems with replacing parentheses in combination with variables, in ssh. For instance, replacing (hello123blablabla) with (hello). So, it replaces all together, and parentheses as well, at ...
-2votes
1answer
244views
"for" loop is not executing on the remote server using SSH
The below "for" loop works locally on the same server. But when triggered through "ssh" protocol on remote servers, the output is not received. Please, can anyone suggest how to ...
2votes
1answer
465views
if var='value' then in Zsh: Is it really a valid syntax without semicolon?
The following code works on Zsh 5.8 that I tried, despite the missing semicolon. But is it really a valid Zsh syntax? #!/bin/zsh if var='value' then echo 'then' fi Without an assignation that ...
0votes
1answer
268views
how to check for specific string in a file named abc.txt and write that missing string to another file (xyz.txt) using a shell script?
For example, generally I need to check for 5 strings. (Note : the strings are in file format .txt) file1.txt file2.txt file3.txt file4.txt file5.txt but there are 3 strings in abc.txt file1.txt ...
1vote
1answer
475views
Read content of file in ksh and split it by ','
My file.txt contains the following content:- ./raw_input/0009/img.raw,./raw_input/0009/calib.raw
0votes
3answers
1kviews
Script to keep the latest 5 files and rest will be moved to other destination
Source path: /var/log/ Here I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl I can move all the files to the other destination named /home/spsy/logs_bkp. But I want to keep latest 5 files in ...
0votes
1answer
202views
Error in script to check(or wait) for availability of file in directory
I want to write a shell script that checks if trigger file is available in my directory or not. If not available I want the code to wait for, say 1 hour, and check again for availability until found. ...
1vote
2answers
84views
Varibles - Union [duplicate]
FICH10=primero.sh FICH20=segundo.sh for i in 10 20 do echo $FICH($i) # I want resolved first $i and then resolver var FICH10 done I want it to first solve $i and concatenate it to the FICH ...
-1votes
2answers
2kviews
Convert array into string
I have a string say, test_var=ab_c_de_fg_.txt. I need to store ab_c in one variable (characters before the 2nd _) and de_fg_ in a second variable (characters after the second _ and before .txt), so ...
-1votes
3answers
234views
Mapping readings with labels [closed]
Given a list of readings in the following format: 1 1 0 0 2 3 23101 23101 0 0 2 0 5 2 0 0 1 1 0 0 2 2 23104 23104 0 0 1 0 5 1 0 0 What would be an approriate (and clean !) way to map them to their ...
1vote
0answers
498views
ksh keybind trap
I am trying to follow this code sample http://www.kornshell.com/examples/keybind # Example from page 98 typeset -A Keytable trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD function keybind # key [...
1vote
2answers
1kviews
Remove noglob from $@ variable
I want to pass an argument to the shell script but I am getting noglob on as an output argument. a.sh #!/bin/ksh set filec on set noglob on echo $@ When I run the shell script with an argument as ...
2votes
2answers
3kviews
Executing Shell script commands sequentially
My script (.ksh) : cmd1 & cmd2 I want cmd1 to be executed in the background and cmd2 to start executing only after cmd1 has started. But, when I run my script, cmd2 is starting before cmd1, ...
-2votes
1answer
198views
Shell Script for formatted output [closed]
06/26/2017 23:40:40 CAUAJM_I_10082 [aspsun14 connected for IOALPPRXXBD_ALPGLGENFAALL 55443.15215291.1] 06/26/2017 23:40:40 CAUAJM_I_40245 EVENT: CHANGE_STATUS STATUS: STARTING ...
1vote
1answer
644views
How many elements can an array store in unix script?
I need to check the file permissions of directories /usr, /tmp, /var and their contents of sub directories. I have taken the file permissions of the directory and its sub directory files in an array ...